package
{

	import flash.display.MovieClip;


public dynamic class Copper extends MovieClip
{
    var grav: Number = 1.2;
    var EF;
	/*
    var _name;
    var _parent;
    var _width;
    var _x;
    var _xscale;
    var _y;
	*/
    var caughtPlayer;
    var num;
    var stayCount;
    var xv;
    var yv;

    function Copper()
    {
        super();
    }

    function init()
    {
        this.num = Number(this.name.substr(3, this.name.length - 3));
        trace("Num:" + this.num);
        this.xv = this.yv = 0;
        this.EF = this.fallEF;
        this.caughtPlayer = [];
        if (this.x < 285) 
        {
            this.scaleX = -100;
        }
    }

    function fallEF()
    {
        this.x = this.x + this.xv;
        this.y = this.y + this.yv;
        this.yv = this.yv + this.grav;
        if (this.parent.parent.ground.hitTest(this.x, this.y, true)) 
        {
            this.hitGround();
        }
        if (this.x < -10 || this.x > 610 || this.y > 460) 
        {
            this.parent.parent.removeObject(this);
        }
    }

    function stayEF()
    {
        var __reg3 = this.parent.parent.checkEnemyHitWide(this);
        if (__reg3.length > 0) 
        {
            var __reg5 = this.xv;
            for (var __reg4 in __reg3) 
            {
                var __reg2 = __reg3[__reg4];
                if (!__reg2.stopped && Math.abs(__reg2.x - this.x) < this.width / 2) 
                {
                    __reg2.turn(this);
                }
            }
        }
        if (this.stayCount++ > 150) 
        {
            for (__reg4 in this.caughtPlayer) 
            {
                this.caughtPlayer[__reg4].stopped = false;
            }
            this.parent.parent.removeObject(this);
        }
    }

    function hitGround()
    {
        this.stayCount = 0;
        var __reg2 = this.parent.parent.findPathPoint(this.x);
        this.y = this.parent.parent.pointsA[__reg2].y;
        this.EF = this.stayEF;
    }

}


}
